#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	int n, m, w;
	cin >> w >> n >> m;
	m--, n--;
	int x1 = n / w;
	int x2 = m / w;
	int y1 = n % w;
	int y2 = m % w;
	if (x1 % 2) {
		y1 = w - 1 - y1;
	}
	if (x2 % 2) {
		y2 = w - 1 - y2;
	}
	cout << abs(x1 - x2) + abs(y1 - y2) << endl;
	return 0;
}